package com.reconcile.phone.common.config;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 微信登录配置
 *
 * @author zlj
 * @version 2023/3/3
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "xcx")
public class XcxLoginProperties implements InitializingBean {

  /**
   * appID
   */
  private String appID;
  /**
   * app密匙
   */
  private String appSecret;
  /**
   * 获取access_token失败重试次数
   */
  private Integer tryCount;

  /**
   * 小程序appID常量
   */
  public static String XCX_OPEN_APP_ID;
  /**
   * 小程序app密匙常量
   */
  public static String XCX_OPEN_APP_SECRET;
  /**
   * 获取access_token失败重试次数
   */
  public static Integer TRY_COUNT;


  @Override
  public void afterPropertiesSet() {
    XCX_OPEN_APP_ID = this.appID;
    XCX_OPEN_APP_SECRET = this.appSecret;
    TRY_COUNT = this.tryCount;
  }
}
